<template>
  <div class="app-container report">
    <el-form inline>
      <el-row :gutter="10" class="mb8">
        <el-col :span="24">
          <el-form-item label="检验日期:">
            <Date-picker
              type="date"
              placeholder="选择日期"
              style="width: 120px"
              v-model="queryParams.xjtDateBegin"
              @on-change="get_date($event, 's')"
            ></Date-picker>
            —
            <Date-picker
              type="date"
              placeholder="选择日期"
              style="width: 120px"
              v-model="queryParams.xjtDateEnd"
              @on-change="get_date($event, 'e')"
            ></Date-picker>
          </el-form-item>
          <el-form-item label="机台编号:">
            <el-select filterable clearable v-model="queryParams.xjtJtbh">
              <el-option
                v-for="item in listJtmJtbh"
                :key="item"
                :label="item"
                :value="item"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="客户编码:">
            <HdSelectMaterial
              v-model="queryParams.xjtCustwldm"
              keyName="itmCustwldm"
            />
          </el-form-item>
          <el-form-item>
            <Button type="info" style="display: inline-block" @click="getList"
              >查询</Button
            >
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div style="position: relative">
      <div style="position: absolute; right: 0; top: -30px">
        <Page
          :total="total"
          :current.sync="queryParams.pageNum"
          simple
          :page-size="queryParams.pageSize"
          show-elevator
          @on-change="pageChange"
        ></Page>
      </div>
      <el-table
        id="NoPlanAssign"
        border
        stripe
        :data="xjtData"
        highlight-current-row
        :header-cell-style="{ 'text-align': 'center' }"
      >
        <el-table-column label="#" width="40" type="index" align="center" />
        <el-table-column
          label="机台编号"
          :show-overflow-tooltip="true"
          width="150"
          align="center"
          prop="xjtJtbh"
        />
        <el-table-column
          label="检验日期"
          :show-overflow-tooltip="true"
          width="100"
          align="center"
          prop="xjtJyrq"
        />
        <el-table-column
          label="班次代码"
          :show-overflow-tooltip="true"
          width="100"
          align="center"
          prop="xjtBbdm"
        />
        <el-table-column
          label="巡检时段"
          :show-overflow-tooltip="true"
          width="100"
          align="center"
          prop="xjtXjrq"
        />
        <el-table-column
          label="客户编码"
          :show-overflow-tooltip="true"
          width="150"
          align="center"
          prop="xjtCustwldm"
        />
        <el-table-column
          label="物料品名"
          :show-overflow-tooltip="true"
          width="250"
          prop="xjtWlpm"
        />
        <el-table-column
          label="操作"
          align="center"
          width="100"
          class-name="small-padding fixed-width"
        >
          <template #default="scope">
            <el-button size="mini" type="text" @click="handleUpdate(scope.row)"
              >填写</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>

    <el-dialog v-model="open" fullscreen width="100%" class="myDialog">
      <h1 style="text-align: center; margin-top: 18px">
        {{ $store.state.settings.sysName.slice(0, 2) }}衡德注塑车间巡检表
      </h1>
      <div style="float: right">
        <span>日期：</span>
        <span style="margin-right: 15px">{{ xjtDataRow.xjtJyrq }}</span>
        <span>班次：</span>
        <span>{{ xjtDataRow.xjtBbdm }}</span>
      </div>
      <el-table
        ref="table1"
        :data="tableData"
        v-loading="loading"
        style="width: 100%; font-size: 12px"
        row-class-name="warning-row"
        :header-cell-style="{ 'text-align': 'center', padding: '2px' }"
        :cell-style="{ padding: '2px 2px' }"
        height="calc(100% - 50px)"
      >
        <el-table-column
          label="机台"
          align="center"
          prop="xjtJtbh"
          width="60"
        ></el-table-column>
        <el-table-column
          label="物料编码"
          align="center"
          prop="xjtCustWldm"
          width="135"
        ></el-table-column>
        <el-table-column
          label="物料品名"
          align="center"
          prop="xjtWlpm"
          width="135"
        />
        <el-table-column
          label="检查产品有无飞边毛刺、料花、缩水、气纹、色纹、黑纹、变形、分层、缺料、划伤、黑点、杂质、熔接痕等外观不良现象"
          align="center"
          width="350"
        >
          <el-table-column
            :label="hTime.H1"
            align="center"
            prop="xjtViewTen"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H1">
                <el-select
                  placeholder=" "
                  v-model="scope.row.xjtViewTen"
                  :class="{ demoColor: hTime.H1 === timeDay }"
                  style="width: 40px"
                  size="mini"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H2"
            align="center"
            prop="xjtViewZero"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H2">
                <el-select
                  placeholder=" "
                  :class="{ demoColor: hTime.H2 === timeDay }"
                  v-model="scope.row.xjtViewZero"
                  style="width: 40px"
                  size="mini"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H3"
            align="center"
            prop="xjtViewTwo"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H3">
                <el-select
                  placeholder=" "
                  v-model="scope.row.xjtViewTwo"
                  :class="{ demoColor: hTime.H3 === timeDay }"
                  style="width: 40px"
                  size="mini"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H4"
            align="center"
            prop="xjtViewFour"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H4">
                <el-select
                  placeholder=" "
                  v-model="scope.row.xjtViewFour"
                  :class="{ demoColor: hTime.H4 === timeDay }"
                  style="width: 40px"
                  size="mini"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H5"
            align="center"
            prop="xjtViewSix"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H5">
                <el-select
                  placeholder=" "
                  v-model="scope.row.xjtViewSix"
                  :class="{ demoColor: hTime.H5 === timeDay }"
                  style="width: 40px"
                  size="mini"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </HdFormItem>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column align="center" width="240">
          <template #header>
            <span class="required">色差值（填写E值）</span>
          </template>
          <el-table-column
            :label="hTime.H1"
            align="center"
            prop="xjtColourTen"
            width="60"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H1">
                <autocomplete-sc
                  v-model="scope.row.xjtColourTen"
                  size="mini"
                  :class="{ demoColor: hTime.H1 === timeDay }"
                  class="inputWidth"
                  placeholder=" "
                ></autocomplete-sc>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H2"
            align="center"
            prop="xjtColourZero"
            width="60"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H2">
                <autocomplete-sc
                  v-model="scope.row.xjtColourZero"
                  size="mini"
                  class="inputWidth"
                  :class="{ demoColor: hTime.H2 === timeDay }"
                  placeholder=" "
                ></autocomplete-sc>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H3"
            align="center"
            prop="xjtColourTwo"
            width="60"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H3">
                <autocomplete-sc
                  v-model="scope.row.xjtColourTwo"
                  size="mini"
                  class="inputWidth"
                  :class="{ demoColor: hTime.H3 === timeDay }"
                  placeholder=" "
                ></autocomplete-sc>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H4"
            align="center"
            prop="xjtColourFour"
            width="60"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H4">
                <autocomplete-sc
                  v-model="scope.row.xjtColourFour"
                  size="mini"
                  class="inputWidth"
                  :class="{ demoColor: hTime.H4 === timeDay }"
                  placeholder=" "
                ></autocomplete-sc>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H5"
            align="center"
            prop="xjtColourSix"
            width="60"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H5">
                <autocomplete-sc
                  v-model="scope.row.xjtColourSix"
                  size="mini"
                  class="inputWidth"
                  :class="{ demoColor: hTime.H5 === timeDay }"
                  placeholder=" "
                ></autocomplete-sc>
              </HdFormItem>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="光泽度" align="center">
          <el-table-column
            :label="hTime.H1"
            align="center"
            prop="xjtLustre1"
            width="60"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H1">
                <!-- <el-input
                  v-model="scope.row.xjtLustre1"
                  :class="{ demoColor: hTime.H1 === timeDay }"
                  class="inputWidth"
                  size="mini"
                  :disabled="timeDay != hTime.H1"
                  placeholder=" "></el-input> -->
                <autocomplete-sc
                  v-model="scope.row.xjtLustre1"
                  size="mini"
                  :class="{ demoColor: hTime.H1 === timeDay }"
                  class="inputWidth"
                  placeholder=" "
                ></autocomplete-sc>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H2"
            align="center"
            prop="xjtLustre2"
            width="60"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H2">
                <!-- <el-input
                  v-model="scope.row.xjtLustre2"
                  :class="{ demoColor: hTime.H2 === timeDay }"
                  class="inputWidth"
                  size="mini"
                  :disabled="timeDay != hTime.H2"
                  placeholder=" "></el-input> -->
                <autocomplete-sc
                  v-model="scope.row.xjtLustre2"
                  size="mini"
                  :class="{ demoColor: hTime.H2 === timeDay }"
                  class="inputWidth"
                  placeholder=" "
                ></autocomplete-sc>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H3"
            align="center"
            prop="xjtLustre3"
            width="60"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H3">
                <!-- <el-input
                  v-model="scope.row.xjtLustre3"
                  :class="{ demoColor: hTime.H3 === timeDay }"
                  class="inputWidth"
                  size="mini"
                  :disabled="timeDay != hTime.H3"
                  placeholder=" "></el-input> -->
                <autocomplete-sc
                  v-model="scope.row.xjtLustre3"
                  size="mini"
                  :class="{ demoColor: hTime.H3 === timeDay }"
                  class="inputWidth"
                  placeholder=" "
                ></autocomplete-sc>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H4"
            align="center"
            prop="xjtLustre4"
            width="60"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H4">
                <autocomplete-sc
                  v-model="scope.row.xjtLustre4"
                  size="mini"
                  :class="{ demoColor: hTime.H4 === timeDay }"
                  class="inputWidth"
                  placeholder=" "
                ></autocomplete-sc>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H5"
            align="center"
            prop="xjtLustre5"
            width="60"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H5">
                <autocomplete-sc
                  v-model="scope.row.xjtLustre5"
                  size="mini"
                  :class="{ demoColor: hTime.H5 === timeDay }"
                  class="inputWidth"
                  placeholder=" "
                ></autocomplete-sc>
              </HdFormItem>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column
          label="材料、标识、装配性能及包装是否合格"
          align="center"
        >
          <el-table-column
            :label="hTime.H1"
            align="center"
            prop="xjtMaterialLogoTen"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H1">
                <el-select
                  placeholder=" "
                  v-model="scope.row.xjtMaterialLogoTen"
                  :class="{ demoColor: hTime.H1 === timeDay }"
                  style="width: 40px"
                  size="mini"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H2"
            align="center"
            prop="xjtMaterialLogoZero"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H2">
                <el-select
                  placeholder=" "
                  v-model="scope.row.xjtMaterialLogoZero"
                  :class="{ demoColor: hTime.H2 === timeDay }"
                  style="width: 40px"
                  size="mini"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H3"
            align="center"
            prop="xjtMaterialLogoTwo"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H3">
                <el-select
                  placeholder=" "
                  v-model="scope.row.xjtMaterialLogoTwo"
                  :class="{ demoColor: hTime.H3 === timeDay }"
                  style="width: 40px"
                  size="mini"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H4"
            align="center"
            prop="xjtMaterialLogoFour"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H4">
                <el-select
                  placeholder=" "
                  v-model="scope.row.xjtMaterialLogoFour"
                  style="width: 40px"
                  :class="{ demoColor: hTime.H4 === timeDay }"
                  size="mini"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H5"
            align="center"
            prop="xjtMaterialLogoSix"
            style="width: 40px"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H5">
                <el-select
                  placeholder=" "
                  v-model="scope.row.xjtMaterialLogoSix"
                  style="width: 40px"
                  :class="{ demoColor: hTime.H5 === timeDay }"
                  size="mini"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </HdFormItem>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="尺寸" align="center" width="120">
          <el-table-column label="标准尺寸一" align="center">
            <el-table-column label="标准尺寸二" align="center" width="120">
              <template #default="scope">
                <div class="divHeight">
                  <div
                    v-if="!isNaN(parseFloat(scope.row.xjtJccc1X).toFixed(2))"
                  >
                    {{ parseFloat(scope.row.xjtJccc1X).toFixed(2) }} ~
                    {{ parseFloat(scope.row.xjtJccc1S).toFixed(2) }}
                  </div>
                </div>
                <div style="height: 20px">
                  <div
                    v-if="!isNaN(parseFloat(scope.row.xjtJccc2X).toFixed(2))"
                  >
                    {{ parseFloat(scope.row.xjtJccc2X).toFixed(2) }} ~
                    {{ parseFloat(scope.row.xjtJccc2S).toFixed(2) }}
                  </div>
                </div>
              </template>
            </el-table-column>
          </el-table-column>
        </el-table-column>
        <el-table-column align="center" width="250">
          <template #header>
            <span class="required">实测尺寸</span>
          </template>
          <el-table-column
            :label="hTime.H1"
            align="center"
            prop="xjtSizeoneCavoneTen"
            width="80"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H1">
                <div>
                  <div>
                    <el-input
                      v-model="scope.row.xjtSizeoneCavoneTen"
                      :class="{ demoColor: hTime.H1 === timeDay }"
                      class="inputWidth"
                      size="mini"
                      :disabled="timeDay != hTime.H1"
                      placeholder=" "
                    ></el-input>
                  </div>
                  <div>
                    <el-input
                      v-model="scope.row.xjtSizetwoCavoneTen"
                      size="mini"
                      :class="{ demoColor: hTime.H1 === timeDay }"
                      class="inputWidth"
                      :disabled="timeDay != hTime.H1"
                      placeholder=" "
                    ></el-input>
                  </div>
                </div>
                <template #read>
                  <div>
                    <div class="divHeight">
                      {{ scope.row.xjtSizeoneCavoneTen }}
                    </div>
                    <div style="height: 20px">
                      {{ scope.row.xjtSizetwoCavoneTen }}
                    </div>
                  </div>
                </template>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H2"
            align="center"
            prop="xjtSizeoneCavoneZero"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H2">
                <div>
                  <div>
                    <el-input
                      v-model="scope.row.xjtSizeoneCavoneZero"
                      class="inputWidth"
                      :class="{ demoColor: hTime.H2 === timeDay }"
                      size="mini"
                      :disabled="timeDay != hTime.H2"
                      placeholder=" "
                    ></el-input>
                  </div>
                  <div>
                    <el-input
                      v-model="scope.row.xjtSizetwoCavoneZero"
                      class="inputWidth"
                      :class="{ demoColor: hTime.H2 === timeDay }"
                      size="mini"
                      :disabled="timeDay != hTime.H2"
                      placeholder=" "
                    ></el-input>
                  </div>
                </div>
                <template #read>
                  <div>
                    <div class="divHeight">
                      {{ scope.row.xjtSizeoneCavoneZero }}
                    </div>
                    <div style="height: 20px">
                      {{ scope.row.xjtSizetwoCavoneZero }}
                    </div>
                  </div>
                </template>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H3"
            align="center"
            prop="xjtSizeoneCavoneTwo"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H3">
                <div>
                  <div>
                    <el-input
                      v-model="scope.row.xjtSizeoneCavoneTwo"
                      size="mini"
                      class="inputWidth"
                      :class="{ demoColor: hTime.H3 === timeDay }"
                      :disabled="timeDay != hTime.H3"
                      placeholder=" "
                    ></el-input>
                  </div>
                  <div>
                    <el-input
                      v-model="scope.row.xjtSizetwoCavoneTwo"
                      size="mini"
                      class="inputWidth"
                      :class="{ demoColor: hTime.H3 === timeDay }"
                      :disabled="timeDay != hTime.H3"
                      placeholder=" "
                    ></el-input>
                  </div>
                </div>
                <template #read>
                  <div>
                    <div class="divHeight">
                      {{ scope.row.xjtSizeoneCavoneTwo }}
                    </div>
                    <div style="height: 20px">
                      {{ scope.row.xjtSizetwoCavoneTwo }}
                    </div>
                  </div>
                </template>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H4"
            align="center"
            prop="xjtSizeoneCavoneFour"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H4">
                <div>
                  <div>
                    <el-input
                      v-model="scope.row.xjtSizeoneCavoneFour"
                      class="inputWidth"
                      :class="{ demoColor: hTime.H4 === timeDay }"
                      size="mini"
                      :disabled="timeDay != hTime.H4"
                      placeholder=" "
                    ></el-input>
                  </div>
                  <div>
                    <el-input
                      v-model="scope.row.xjtSizetwoCavoneFour"
                      class="inputWidth"
                      size="mini"
                      :class="{ demoColor: hTime.H4 === timeDay }"
                      :disabled="timeDay != hTime.H4"
                      placeholder=" "
                    ></el-input>
                  </div>
                </div>
                <template #read>
                  <div>
                    <div class="divHeight">
                      {{ scope.row.xjtSizeoneCavoneFour }}
                    </div>
                    <div style="height: 20px">
                      {{ scope.row.xjtSizetwoCavoneFour }}
                    </div>
                  </div>
                </template>
              </HdFormItem>
            </template>
          </el-table-column>
          <el-table-column
            :label="hTime.H5"
            align="center"
            prop="xjtSizeoneCavoneSix"
            width="50"
          >
            <template #default="scope">
              <HdFormItem :readOnly="!scope.row.edit || timeDay != hTime.H5">
                <div>
                  <div>
                    <el-input
                      v-model="scope.row.xjtSizeoneCavoneSix"
                      size="mini"
                      :class="{ demoColor: hTime.H5 === timeDay }"
                      class="inputWidth"
                      :disabled="timeDay != hTime.H5"
                      placeholder=" "
                    ></el-input>
                  </div>
                  <div>
                    <el-input
                      v-model="scope.row.xjtSizetwoCavoneSix"
                      size="mini"
                      class="inputWidth"
                      :class="{ demoColor: hTime.H5 === timeDay }"
                      :disabled="timeDay != hTime.H5"
                      placeholder=" "
                    ></el-input>
                  </div>
                </div>
                <template #read>
                  <div>
                    <div class="divHeight">
                      {{ scope.row.xjtSizeoneCavoneSix }}
                    </div>
                    <div style="height: 20px">
                      {{ scope.row.xjtSizetwoCavoneSix }}
                    </div>
                  </div>
                </template>
              </HdFormItem>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="标准重量" align="center" width="100">
          <template #default="scope">
            <div>
              {{
                parseFloat(scope.row.xjtJzX).toFixed(1) +
                "~" +
                parseFloat(scope.row.xjtJzS).toFixed(1)
              }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="xjtWeightoneCavoneTen"
          width="100"
        >
          <template #header>
            <span class="required">实测</span>
          </template>
          <template #default="scope">
            <HdFormItem :readOnly="!scope.row.edit">
              <el-input
                v-model="scope.row.xjtWeightoneCavoneTen"
                :disabled="!openTrue"
                :class="{ demoColor: openTrue }"
                size="mini"
                style="width: 60px"
                placeholder=" "
              ></el-input>
            </HdFormItem>
          </template>
        </el-table-column>
        <el-table-column
          label="备注"
          align="center"
          prop="xjtDescTen"
          width="150"
        >
          <template #default="scope">
            <HdFormItem :readOnly="!scope.row.edit">
              <autocomplete-bz
                v-model="scope.row.xjtDescTen"
                style="width: 130px"
                placeholder=" "
              ></autocomplete-bz>
            </HdFormItem>
          </template>
        </el-table-column>
        <el-table-column
          label="检验员"
          align="center"
          prop="xjtJyryTenName"
          width="100"
        ></el-table-column>
        <el-table-column label="操作" width="80" align="center">
          <template #default="scope">
            <HdFormItem :readOnly="!scope.row.edit">
              <el-button size="mini" type="text" @click="handleSave(scope.row)"
                >保存</el-button
              >
              <template #read><div /></template>
            </HdFormItem>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer"></div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listXjtData,
  listXjtDataByUniversal,
  saveDetailNowDayByUniversal,
} from "@/api/quality/productBom";
import { parseTime } from "@/utils/ruoyi";
import AutocompleteBz from "../AutocompleteBz.vue";
import AutocompleteSc from "../AutocompleteSc.vue";
import mixins from "@/mixins/common";

export default {
  components: { AutocompleteBz, AutocompleteSc },
  mixins: [mixins.listJtmJtbh],
  data() {
    return {
      //外部数据表格
      xjtData: [],
      tableH: document.body.clientHeight > 700 ? 450 : 310,
      xjtDataRow: [],
      tableData: [],
      tableData2: [],
      title: "",
      open: false,
      dom1: null,
      dom2: null,
      //当前时间
      nowTime: "",
      check_search: false,
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: document.body.clientHeight > 900 ? 25 : 17,
        xjtType: "E",
        xjtDateBegin: this.$moment().add(-1, "days").format("YYYY-MM-DD"),
        xjtDateEnd: this.$moment().add(1, "days").format("YYYY-MM-DD"),
      },
      timeDay: null,
      openTrue: true,
      openTrue2: true,
      hTime: {
        H1: "H1",
        H2: "H2",
        H3: "H3",
        H4: "H4",
        H5: "H5",
      },
      options: [
        {
          value: "√",
          label: "√",
        },
        {
          value: "×",
          label: "×",
        },
      ],
      loading: false,
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.queryParams.xjtDateBegin = this.moment(
        this.queryParams.xjtDateBegin
      ).format("YYYY-MM-DD");
      this.queryParams.xjtDateEnd = this.moment(
        this.queryParams.xjtDateEnd
      ).format("YYYY-MM-DD");

      listXjtData(this.queryParams).then((res) => {
        this.xjtData = res.rows;
        this.total = res.total;
      });
    },
    handleUpdate(row) {
      console.log(row);
      this.xjtDataRow = row;
      this.open = true;
      this.loading = true;
      this.timeDay = row.timeDay;
      //当前时间段
      this.nowTime = row.timeDay;
      //请求数据,按照机台编号,
      let objAdd = {
        xjtBbdm: row.xjtBbdm,
        xjtJyrq: row.xjtJyrq,
        xjtType: "E",
        xjtXjrq: row.xjtXjrq,
        //xjtId: row.xjtId,
        xjtCustwldm: row.xjtCustwldm,
        xjtJtbh: row.xjtJtbh,
        xjtIds: row.xjtIds,
      };
      listXjtDataByUniversal(objAdd).then((res) => {
        this.tableData = res.data.list1;
        this.tableData2 = res.data.list2;
        this.tableData.map((item, idx) => {
          // if (idx !== 0) {
          //   delete item.xjtId
          // }
          item.edit = true;
          if (item.xjtWeightoneCavoneTen) {
            this.openTrue = false;
          } else {
            this.openTrue = true;
          }
          if (item.xjtWeightoneCavtwoTen) {
            this.openTrue2 = false;
          } else {
            this.openTrue2 = true;
          }
        });
        this.tableData = this.tableData.concat(res.data.list2).map((o) => {
          if (o.xjtInformation) {
            let obj = JSON.parse(o.xjtInformation);
            o = Object.assign(o, obj);
          }
          return o;
        });
        this.loading = false;
      });
    },
    handleSave(row) {
      row.xjtJyryTen = this.$store.getters.name;
      switch (this.timeDay) {
        case "H1":
          row.xjtAnalyzeTen = this.getTime();
          row.xjtFlagTen = "1";
          break;
        case "H2":
          row.xjtAnalyzeZero = this.getTime();
          row.xjtFlagZero = "1";
          break;
        case "H3":
          row.xjtAnalyzeTwo = this.getTime();
          row.xjtFlagTwo = "1";
          break;
        case "H4":
          row.xjtAnalyzeFour = this.getTime();
          row.xjtFlagFour = "1";
          break;
        case "H5":
          row.xjtAnalyzeSix = this.getTime();
          row.xjtFlagSix = "1";
          break;
      }
      let tmpObj = {};
      for (let i = 5; i > 0; i--) {
        let k = "xjtLustre" + i;
        if (row[k]) tmpObj[k] = row[k];
      }
      row.xjtInformation = JSON.stringify(tmpObj);
      if (this.testRules(this.timeDay, row)) {
      } else {
        saveDetailNowDayByUniversal(row).then((res) => {
          //this.open = false
          this.$message.success("保存成功");
          //this.getList()
        });
      }
    },
    cancel() {
      this.open = false;
    },
    get_date(e, type) {
      if (type === "s") {
        this.queryParams.xjtDateBegin = e;
      } else if (type === "e") {
        this.queryParams.xjtDateEnd = e;
      }
    },
    getTime(time = new Date()) {
      return parseTime(time);
    },
    pageChange(page) {
      this.queryParams.pageNum = page;
      this.getList();
    },
    testRules(day, row) {
      switch (day) {
        case "H1":
          if (!row.xjtColourTen) {
            this.$message.error("色差值必填！");
            return true;
          } else if (
            !(
              row.xjtSizeoneCavoneTen ||
              row.xjtSizeoneCavtwoTen ||
              row.xjtSizetwoCavoneTen ||
              row.xjtSizetwoCavtwoTen
            )
          ) {
            this.$message.error("尺寸必填！");
            return true;
          } else if (
            !(row.xjtWeightoneCavoneTen || row.xjtWeightoneCavtwoTen)
          ) {
            this.$message.error("重量必填！");
            return true;
          } else {
            return false;
          }
          break;
        case "H2":
          if (!row.xjtColourZero) {
            this.$message.error("色差值必填！");
            return true;
          } else if (
            !(
              row.xjtSizeoneCavoneZero ||
              row.xjtSizeoneCavtwoZero ||
              row.xjtSizetwoCavoneZero ||
              row.xjtSizetwoCavtwoZero
            )
          ) {
            this.$message.error("尺寸必填！");
            return true;
          } else if (
            !(row.xjtWeightoneCavoneTen || row.xjtWeightoneCavtwoTen)
          ) {
            this.$message.error("重量必填！");
            return true;
          } else {
            return false;
          }
          break;
        case "H3":
          if (!row.xjtColourTwo) {
            this.$message.error("色差值必填！");
            return true;
          } else if (
            !(
              row.xjtSizeoneCavoneTwo ||
              row.xjtSizeoneCavtwoTwo ||
              row.xjtSizetwoCavoneTwo ||
              row.xjtSizetwoCavtwoTwo
            )
          ) {
            this.$message.error("尺寸必填！");
            return true;
          } else if (
            !(row.xjtWeightoneCavoneTen || row.xjtWeightoneCavtwoTen)
          ) {
            this.$message.error("重量必填！");
            return true;
          } else {
            return false;
          }
          break;
        case "H4":
          if (!row.xjtColourFour) {
            this.$message.error("色差值必填！");
            return true;
          } else if (
            !(
              row.xjtSizeoneCavoneFour ||
              row.xjtSizeoneCavtwoFour ||
              row.xjtSizetwoCavoneFour ||
              row.xjtSizetwoCavtwoFour
            )
          ) {
            this.$message.error("尺寸必填！");
            return true;
          } else if (
            !(row.xjtWeightoneCavoneTen || row.xjtWeightoneCavtwoTen)
          ) {
            this.$message.error("重量必填！");
            return true;
          } else {
            return false;
          }
          break;
        case "H5":
          if (!row.xjtColourSix) {
            this.$message.error("色差值必填！");
            return true;
          } else if (
            !(
              row.xjtSizeoneCavoneSix ||
              row.xjtSizeoneCavtwoSix ||
              row.xjtSizetwoCavoneSix ||
              row.xjtSizetwoCavtwoSix
            )
          ) {
            this.$message.error("尺寸必填！");
            return true;
          } else if (
            !(row.xjtWeightoneCavoneTen || row.xjtWeightoneCavtwoTen)
          ) {
            this.$message.error("重量必填！");
            return true;
          } else {
            return false;
          }
          break;
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.report {
  input {
    width: 60px;
  }

  table {
    width: 100%;
    height: 50px;
    border-spacing: 0;
    border-collapse: collapse;
    text-align: center;
    font-weight: bold;
  }

  table td {
    height: 40px;
    width: 82px;
    border: 1px solid black;
  }

  .xjTable {
    width: 100%;
    text-align: center;
    font-size: 24px;
    height: 48px;
    font-weight: bold;
  }

  .hdLogo {
    position: absolute;
    left: 34px;
    bottom: 8px;
    width: 130px;
    height: 58px;
  }

  .xjOrder {
    position: absolute;
    right: 70px;
    bottom: 2px;
    font-weight: bold;
    font-size: 16px;
  }
  ::v-deep .el-table thead th {
    height: 30px;
    font-size: 12px;
    padding: 0px 0px 0px 0px;
    color: #47494e;
    background: #f8f8f8 !important;
  }

  .myDialog {
    ::v-deep .el-table td .cell {
      height: 100%;
    }
    ::v-deep .el-select .el-input .el-input__suffix .el-input__suffix-inner {
      display: none;
    }

    ::v-deep .el-table__body-wrapper .el-select .el-input .el-input__inner {
      text-align: center;
    }
    /*z*/
    ::v-deep .el-input__inner {
      padding: 0;
      height: 23px;
      line-height: 23px;
      color: #000;
    }
    ::v-deep .divHeight {
      border-bottom: 1px solid #868686;
      height: 20px;
    }
    ::v-deep .demoColor input {
      background: #ffb3a7 !important;
    }
  }
}
</style>
